<template>
  <div class="new_right">
    <div class="title">
      <Title1 title="统计数据"></Title1>
      <div class="device_status">
        <div
          class="d_s_item"
          v-for="(i, index) in deviceStatusArr"
          :key="index"
        >
          <div class="item_title">
            <Title2 :title="i.title" />
            <div class="container">
              <img :src="getImgSrc(index)" alt="" srcset="" />
              <div class="nums_line">
                <div class="nums">
                  <p>
                    <i>设备总数</i>
                    <i class="in_line_num">{{ i.inLine + i.offLine }}</i>
                  </p>
                </div>
                <div class="is_line">
                  <span
                    >在线：<span style="color: #13ff95">{{ i.inLine }}</span>
                  </span>
                  <span
                    >离线：<span style="color: #ff9413">{{
                      i.offLine
                    }}</span></span
                  >
                  <span
                    >在线率：<span style="color: #ffe04d">
                      {{
                        ((i.inLine / (i.offLine + i.inLine)) * 100).toFixed(2)
                      }}%
                    </span>
                  </span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Title1 from "./Title1.vue";
import Title2 from "./Title2.vue";

export default {
  components: {
    Title1,
    Title2,
  },
  props: {},
  computed: {},
  watch: {},
  data() {
    return {
      deviceStatusArr: [
        {
          title: "客流检测",
          inLine: 102,
          offLine: 48,
        },
        {
          title: "慢直播",
          inLine: 100,
          offLine: 48,
        },
        {
          title: "视频监控",
          inLine: 102,
          offLine: 20,
        },
        {
          title: "停车闸机",
          inLine: 111,
          offLine: 22,
        },
        {
          title: "三辊闸",
          inLine: 102,
          offLine: 15,
        },
        {
          title: "智慧厕所",
          inLine: 102,
          offLine: 10,
        },
      ],
    };
  },
  methods: {
    getImgSrc(index) {
      return require(`@/assets/images/newImg/rightImg/${index}.png`);
    },
  },
  mounted() {},
  created() {},
  destroyed() {},
};
</script>

<style lang="scss" scoped>
@import "@/utils/px2vwvh.scss";
img {
  @include px2vw(width, 76);
  @include px2vh(height, 88);
}

.new_right {
  width: 100%;
  height: 100%;
  @include px2vw(padding-left, 17);
  @include px2vw(padding-right, 17);
  @include px2vh(padding-top, 21);
  @include px2vh(padding-bottom, 21);
  color: #fff;
  @include px2font(16);

  .device_status {
    width: 100%;
    .d_s_item {
      width: 100%;
      @include px2vh(height, 135);
      .title {
        width: 100%;
        @include px2vh(height, 46);
      }
      .item_title {
      }
      .container {
        width: 100%;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        @include px2vh(margin-top, 10);
        img {
          @include px2vw(width, 76);
          @include px2vh(height, 88);
        }
        .nums_line {
          display: flex;
          flex-wrap: wrap;
          @include px2vw(width, 340);
          @include px2font(16);
          .nums {
            width: 100%;
            background-image: url(~@/assets/images/newImg/rightImg/title_bg.png);
            background-repeat: no-repeat;
            background-position: center center;
            background-size: 100% 100%;
            @include px2vh(margin-bottom, 12);
            @include px2vw(padding-left, 40);
            .in_line_num {
              @include px2vw(margin-left, 20);
              @include px2font(20);
              color: #12cbe1;
            }
          }
          .is_line {
            width: 100%;
            @include px2vw(padding-left, 40);
            display: flex;
            align-items: center;
            justify-content: space-between;
            span {
              display: inline-block;
            }
          }
        }
      }
    }
  }
}
</style>
